local skel = fk.CreateSkill{
  name = "sj3__zhenyue",
  tags = {Skill.Compulsory}
}

Fk:loadTranslationTable{
  ["sj3__zhenyue"] = "枕月",
  [":sj3__zhenyue"] = "<b>锁定技</b>，你拥有“<a href=':biyue'><i>闭月 </i></a>”；回合结束后，你视为对所有与你手牌数相同的角色使用【铁锁连环】。",

  ["$sj3__zhenyue1"] = "",
  ["$sj3__zhenyue2"] = "",
}

skel:addEffect(fk.EventPhaseStart, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.phase == Player.Finish
  end,
  on_cost = function (self, event, target, player, data)
    return player.room:askToSkillInvoke(player,{skill_name = "biyue"})
  end,
  on_use = function(self, event, target, player, data)
    player:drawCards(1, skel.name)
  end,
})

skel:addEffect(fk.TurnEnd, {
  anim_type = "drawcard",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name)
  end,
  on_cost = function (self, event, target, player, data)
    local tos = table.filter(player.room:getAlivePlayers(),function (t)
      return t:getHandcardNum() == player:getHandcardNum() and player:canUseTo(Fk:cloneCard("iron_chain"),t)
    end)
    if #tos > 0 then
      event:setCostData(self,{tos = tos})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:useVirtualCard("iron_chain",nil,player,event:getCostData(self).tos,skel.name)
  end,
})

return skel
